package com.hmall.api.fallback;

import com.hmall.api.client.PayClient;
import com.hmall.api.dto.PayOrderDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

@Slf4j
public class PayClientFallback implements FallbackFactory<PayClient> {
    @Override
    public PayClient create(Throwable cause) {
        return new PayClient() {
            @Override
            public PayOrderDTO queryByBizOrderNo(Long orderId) {
                log.info("远程调用支付方法失败，参数：{}，错误：",orderId,cause);
                return null;
            }

            @Override
            public void updateStatusByBizOrderId(Integer status, Long orderId) {
                log.info("远程调用支付方法失败，参数：状态{}，订单号{}，错误：",status,orderId,cause);
            }
        };
    }
}
